package com.firestone.dao.primary.center;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import com.firestone.bean.dto.role.RoleDTO;
import com.firestone.bean.entity.mysql.primary.ImCenterRole;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author CAIYJ
 * @since 2018-03-27
 */
public interface ImCenterRoleDao extends BaseMapper<ImCenterRole> {

    /**
     * @Description: TODO(角色列表)
     * @param pagination
     * @param wrapper
     * @return
     * @author CAIYJ
     * @date 2018年3月30日 下午5:21:22
     * @lastModifier CAIYJ
     */
    @Select("<script> "
            + "SELECT cr.role_name, cr.`describe`, cr.id, cm.real_name AS create_user, cm1.real_name AS update_user "
            + "FROM im_center_role AS cr "
            + "LEFT JOIN im_center_manager AS cm ON cm.id = cr.creator "
            + "LEFT JOIN im_center_manager AS cm1 ON cm1.id = cr.reviser  "
            + "<where> ${ew.sqlSegment} </where> </script> ")
    <T> List<RoleDTO> selectRoleList(Pagination pagination,
            @Param("ew") Wrapper<T> wrapper);
}
